#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include<algorithm>
using namespace std;

const int N = 1e5 + 9;
int a[N];
int b[N];

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, time;cin >> n >> time;long long sum = 0;
    for (int i = 1;i <= n;i++) { cin >> a[i];sum += a[i]; }
    for (int i = 1;i <= n;i++) { cin >> b[i];b[i] -= a[i]; }
    sort(b + 1, b + 1 + n);
    for (int i = n;i >= 1;i--) {
        if (time == 0 || b[i] <= 0)break;
        sum += b[i];
        time--;
    }
    cout << sum;
    return 0;
}